package com.atguigu.gmall.web.controller;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.feign.order.OrderFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.Map;

/**
 * @author A
 * @version 1.0
 * @description: TODO
 * @date 2024/10/5 1:01
 */
@Controller
public class OrderController {
    @Autowired
    OrderFeignClient orderFeignClient;

    @GetMapping("/myOrder.html")
    public String myOrderPage(){

        return "order/myOrder";
    }

    @GetMapping("/trade.html")
    public String OrderConfirmPage(Model model){
        //TODO 远程调用order客户端
        Result<Map<String, Object>> cartConfirmList = orderFeignClient.getCartConfirmList();
        model.addAllAttributes(cartConfirmList.getData());
        return "order/trade";
    }
}
